/*!  \file  MatrixGenerator.h
 *	  \brief  Implements a class that will initialize matrices with random numbers
 * 
 *   \details   details
 *   \author    Yordan Madzhunkov German Research School for Simulation Sciences GmbH
 *   \version   1.0
 *   \date      05/12/2013 09:53:39 AM
 *   \copyright GNU Public License.
 */
#pragma once
#include "macros.h"
class Matrix;
class RandomGenerator;
class MatrixGenerator {
public:
	MatrixGenerator();
	virtual ~MatrixGenerator();

	void generate(Matrix & m) const;
	void setZeroProb    (const double val) {     hasZeroProb = prob(val); }
	void setNegativeProb(const double val) { hasNegativeProb = prob(val); }
	void setClustersProb(const double val) { hasClustersProb = prob(val); }
	void setScale       (const double val) { scale = val;   }
	void setClusterTolerance(const double val) { relClusterSigma = val;   }
	void generateBiDiagonal(Matrix & bidiag, const Matrix & diag) ;

private:		
	DISALLOW_COPY_AND_ASSIGN(MatrixGenerator);
	double prob(const double val)const { return val<0 ? 0 : val>1 ? 1 : val; }
//	enum Type 		  { General, Orthogonal, Diagonal, BiDiagonal, TriDiagonal};
	void generateGeneral    (Matrix & m) const;
	void generateOrthogonal (Matrix & m) const;
	void generateDiagonal   (Matrix & m) const;
	void generateBiDiagonal (Matrix & m) const;
	void generateTridiagonal(Matrix & m) const;
	RandomGenerator * rng;
	double hasZeroProb;    // probility for diagonal matrix to have zero
	double hasNegativeProb;// probility for diagonal matrix to have negative val
	double hasClustersProb;// probility for having clusters
	double relClusterSigma;//
	double scale; 
};
